﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Xejen.Database.Entities.Auditing
{
    /// <summary>
    /// 表示实体(默认主键类型是<see langword="long"/>)的修改信息
    /// </summary>
    /// <remarks>
    /// 包含修改时间
    /// </remarks>    
    [Serializable]
    public abstract class ModifierEntity : ModifierEntity<long>, IEntity
    {
        /// <inheritdoc cref="ModifierEntity"/>
        protected ModifierEntity() { }
    }

    /// <summary>
    /// 表示实体的修改信息
    /// </summary>
    /// <remarks>
    /// 包含修改时间
    /// </remarks>
    /// <typeparam name="TPrimaryKey">实体的主键类型</typeparam>
    [Serializable]
    public abstract class ModifierEntity<TPrimaryKey> : Entity<TPrimaryKey>, IModificationTime
        where TPrimaryKey : struct
    {
        /// <inheritdoc/>
        [Description("修改时间")]
        public DateTime? ModificationTime { get; set; }

        /// <inheritdoc cref="ModifierEntity{TPrimaryKey}"/>
        protected ModifierEntity()
        {
            ModificationTime = StandardTime.Now;
        }
    }
}
